package com.wang.code;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class _2ArrayListIterator {

	public static void main(String[] args) {
		ArrayList list = new ArrayList();
		
		list.add(1);
		list.add(3.14);
		list.add(true);
		list.add("12");
		list.add("qwe");
		list.add(new int[3]);
		
		Iterator iterator = list.iterator();
		//boolean hasNext() 
		/*if (iterator.hasNext()) {
			//E next()   
			System.out.println(iterator.next());
		}
		if (iterator.hasNext()) {
			//E next() 
			System.out.println(iterator.next());
		}
		*/
//		while (iterator.hasNext()) {
//			System.out.println(iterator.next());
//		}
//		System.out.println(iterator.next());
		
		
//		ListIterator listIterator = list.listIterator();
//		while (listIterator.hasNext()) {
//			System.out.println(listIterator.next());
////			list.add(1);
//		}
//		System.out.println("============");
//		while (listIterator.hasPrevious()) {
//			System.out.println(listIterator.previous());
//		}
		
		
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}
	}

}
